package edu.bbu.commonproject.desktop.gui.view.swing.setup.menus;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Image;

import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JPasswordField;

import edu.bbu.commonproject.desktop.gui.view.swing.utils.Design;

/**
 * The privacy setup panel class.
 */
public class PrivacySetupsPanel extends JPanel
{
	/** The base image. */
	private Image baseImage;
	
	/** The password change label. */
	private JLabel passwordChangeLabel;
	
	/** The new password label. */
	private JLabel newPasswordLabel;
	
	/** The new password field. */
	private JPasswordField newPasswordField;
	
	/** The new password conformation label */
	private JLabel newPassworConfirmationLabel;
	
	/** The new password confirmation field. */
	private JPasswordField newPasswordConfirmationField;
	
	/** the password error label. */
	private JLabel passwordErrorLabel;
	
	/** The delete user account. */
	private JCheckBox deleteUserAccount;
	
	/** The delete user warning. */
	private JLabel deleteUserWarning;
	
	/** The current password label. */
	private JLabel currentPasswordLabel;
	
	/** The current password field. */
	private JPasswordField currentPasswordField;
	
	/** The current password error label. */
	private JLabel currentPasswordErrorLabel;
	
	/** The save button. */
	private JButton saveButton;
	
	/**
	 * The constructor.
	 */
	public PrivacySetupsPanel()
	{
		baseImage = Design.COMPONENT_PRIVACY;
		
		this.setPreferredSize(new Dimension(750, 500));
		this.setLayout(null);
		this.setOpaque(false);
		
		setComponents();
	}
	
	/**
	 * Sets up the components and adds it to the panels.
	 */
	public void setComponents()
	{
		passwordChangeLabel = new JLabel("Change password");
		passwordChangeLabel.setSize(300, 30);
		passwordChangeLabel.setLocation(125, 120);
		passwordChangeLabel.setForeground(Color.WHITE);
		passwordChangeLabel.setFont(new Font("Arial", Font.BOLD, 12));
		
		newPasswordLabel = new JLabel("New password");
		newPasswordLabel.setSize(300, 30);
		newPasswordLabel.setLocation(160, 150);
		newPasswordLabel.setForeground(Color.WHITE);
		newPasswordLabel.setFont(new Font("Arial", Font.BOLD, 12));
		
		newPasswordField = new JPasswordField();
		newPasswordField.setSize(210, 26);
		newPasswordField.setLocation(260, 152);
		
		newPassworConfirmationLabel = new JLabel("Conf. Password");
		newPassworConfirmationLabel.setSize(300, 30);
		newPassworConfirmationLabel.setLocation(160, 180);
		newPassworConfirmationLabel.setForeground(Color.WHITE);
		newPassworConfirmationLabel.setFont(new Font("Arial", Font.BOLD, 12));
		
		newPasswordConfirmationField = new JPasswordField();
		newPasswordConfirmationField.setSize(210, 26);
		newPasswordConfirmationField.setLocation(260, 182);
		
		passwordErrorLabel = new JLabel("Wrong passwords!");
		passwordErrorLabel.setSize(400, 30);
		passwordErrorLabel.setLocation(480, 180);
		passwordErrorLabel.setForeground(Color.ORANGE);
		passwordErrorLabel.setFont(new Font("Arial", Font.BOLD, 12));
		
		deleteUserAccount = new JCheckBox("Delete user account");
		deleteUserAccount.setSize(300, 30);
		deleteUserAccount.setLocation(125, 220);
		deleteUserAccount.setForeground(Color.WHITE);
		deleteUserAccount.setFont(new Font("Arial", Font.BOLD, 12));
		
		deleteUserWarning = new JLabel("Deleting your account will delete your account with all of your files.");
		deleteUserWarning.setSize(400, 30);
		deleteUserWarning.setLocation(160, 240);
		deleteUserWarning.setForeground(Color.ORANGE);
		deleteUserWarning.setFont(new Font("Arial", Font.BOLD, 12));
		
		currentPasswordLabel = new JLabel("Curr. password");
		currentPasswordLabel.setSize(300, 30);
		currentPasswordLabel.setLocation(160, 320);
		currentPasswordLabel.setForeground(Color.WHITE);
		currentPasswordLabel.setFont(new Font("Arial", Font.BOLD, 12));
		
		currentPasswordField = new JPasswordField();
		currentPasswordField.setSize(210, 26);
		currentPasswordField.setLocation(260, 322);
		
		currentPasswordErrorLabel = new JLabel("Wrong passwords!");
		currentPasswordErrorLabel.setSize(400, 30);
		currentPasswordErrorLabel.setLocation(480, 320);
		currentPasswordErrorLabel.setForeground(Color.ORANGE);
		currentPasswordErrorLabel.setFont(new Font("Arial", Font.BOLD, 12));
		
		saveButton = new JButton("Save");
		saveButton.setSize(150, 40);
		saveButton.setLocation(290, 360);
		
		this.add(passwordChangeLabel);
		this.add(newPasswordLabel);
		this.add(newPasswordField);
		this.add(newPassworConfirmationLabel);
		this.add(newPasswordConfirmationField);
		this.add(passwordErrorLabel);
		this.add(deleteUserAccount);
		this.add(deleteUserWarning);
		this.add(currentPasswordLabel);
		this.add(currentPasswordField);
		this.add(currentPasswordErrorLabel);
		this.add(saveButton);
		
	}
	
	/**
	 * The overrided paintComponent.
	 */
	protected void paintComponent(Graphics g)
	{
		g.drawImage(baseImage, 0, 0, null);
	}
	
	/**
	 * Gets the new password field.
	 * @return the new password field.
	 */
	public JPasswordField getNewPasswordField()
	{
		return newPasswordField;
	}
	
	/**
	 * Gets the new password confirmation field.
	 * @return the new password confirmation field.
	 */
	public JPasswordField getNewPasswordConfirmationField()
	{
		return newPasswordConfirmationField;
	}
	
	/**
	 * Gets the password error label.
	 * @return the password error label.
	 */
	public JLabel getPasswordErrorLabel()
	{
		return passwordErrorLabel;
	}
	
	/**
	 * Gets the delete user account.
	 * @return the delete user account.
	 */
	public JCheckBox getDeleteUserAccount()
	{
		return deleteUserAccount;
	}
	
	/**
	 * Gets the current password field.
	 * @return the current password field.
	 */
	public JPasswordField getCurrentPasswordField()
	{
		return currentPasswordField;
	}
	
	/**
	 * Gets the current password error label.
	 * @return the current password error label.
	 */
	public JLabel getCurrentPasswordErrorLabel()
	{
		return currentPasswordErrorLabel;
	}
	
	/**
	 * Get the save button.
	 * @return the save button.
	 */
	public JButton getSaveButton()
	{
		return saveButton;
	}
}
